<?php
if(!defined('ADMINPX') || !defined('ADMIN')) {
	exit('Access Denied');
}
$act=$_GET['act'];
$id=$_GET['id'];
if($act=='ok'){
   $db->update('ly',array( 'type' => $_POST[name] )," `id` =$id");
	 echo "提交成功<br/>";
   echo "正在自动返回.......<br/><a href=\"admin.php?action=ly&\">请手动返回</a><br/><meta http-equiv=refresh content='3;url=admin.php?action=ly&'>";
}else if($act=='scltts'){
	 echo"注意：删除不可恢复！<br/>";
   echo "<a href=\"admin.php?action=ly&act=sclt&id=$id\">确定删除</a><br/>";
}else if($act=='sclt'){
	$db->delete('ly'," `id` = '$id'");
	echo "删除成功<br/>";
   echo "正在自动返回.......<br/><a href=\"admin.php?action=ly&\">请手动返回</a><br/><meta http-equiv=refresh content='3;url=admin.php?action=ly&'>";
}else{
echo '<div class="admin">未读留言<br/></div>';
    $num_count=$db->num_rows('ly',"type ='0'",'id');
    $sql_bbs  =$db->query('ly',"type ='0' ORDER BY `id` ",'');
   while($row_c=mysql_fetch_array($sql_bbs)){
	     $row_c[content]=Bingz_html($row_c[content]);
	     $syxsaa='';
	     $syxsab='';
	     if($row_c[type] == '0'){ $syxsaa="CHECKED "; }else{ $syxsab="CHECKED "; }
       echo"<div class=\"admin_a\">
       姓名：$row_c[name]<br/>
       qq号：$row_c[qq]<br/>
       手机：$row_c[mobile]  <a href=\"admin.php?action=sms&act=post&mobile=$row_c[mobile]\">发送短信</a><br/>
       邮箱：$row_c[email]  <a href=\"admin.php?action=email&act=post&email=$row_c[email]\">发送邮件</a><br/>
       留言内容：<font color=\"#000099\">$row_c[content]</font><br/>";
echo'<form method="POST" action="admin.php?action=ly&act=ok&id='.$row_c[id].'">
提示设置:
     <input type="radio" CHECKED  name="name" value="1" />已阅读
<input class="submit" type="submit" name="adminpost" value="提交"/>
</form>
       </div>';
   }
   if($num_count == '0'){
   	  echo '<div class="admin_a">没有数据！</div>';
   }
   echo $page=page_link($list_num,$num_count);


   echo '<div class="admin">已读留言<br/></div>';
   $num_count=$db->num_rows('ly',"type ='1'",'id');
   $list_num ="10";
   $num_start=page_num($list_num,$num_count);
   $sql_bbs  =$db->query('ly',"type ='1' ORDER BY `id` DESC LIMIT ".$num_start." , ".$list_num." ",'');
   $a        =$num_start+'1';
   while($row_c=mysql_fetch_array($sql_bbs)){
	     $row_c[content]  =Bingz_html($row_c[content]);
	     $syxsaa='';$syxsab='';
	     if($row_c[type] == '0'){ $syxsaa="CHECKED "; }else{ $syxsab="CHECKED "; }
       echo"<div class=\"admin_a\">
       姓名：$row_c[name]<br/>
       qq号：$row_c[qq]<br/>
       手机：$row_c[mobile]  <a href=\"admin.php?action=sms&act=post&mobile=$row_c[mobile]\">发送短信</a><br/>
       邮箱：$row_c[email]  <a href=\"admin.php?action=email&act=post&email=$row_c[email]\">发送邮件</a><br/>
       留言内容：<font color=\"#000099\">$row_c[content]</font><br/>
       <a href=\"admin.php?action=ly&act=scltts&id=$row_c[id]\">删除此条留言</a>
       ";
       echo'</div>';
   }
   echo $page=page_link($list_num,$num_count);
}
   if($num_count == '0'){
   	  echo '<div class="admin_a">没有留言数据！</div>';
   }
   echo "<a href=\"admin.php?action=ly&\">返回留言管理</a><br/>";
?>